package org.bogusware.json.editor;

import org.eclipse.jface.text.rules.*;
import org.eclipse.jface.text.*;

public class JSONScanner extends RuleBasedScanner {

	public JSONScanner(ColorManager manager) {
		IToken comment = new Token(new TextAttribute(manager.getColor(IJSONColorConstants.JSON_COMMENT)));

		IRule[] rules = new IRule[2];
		// Add rule for processing instructions
		rules[0] = new SingleLineRule("//", " ", comment);
		// Add generic whitespace rule.
		rules[1] = new WhitespaceRule(new JSONWhitespaceDetector());

		setRules(rules);
	}
}
